<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<style type="text/css" media="screen,print">
<!--
	body {
		margin: 0px, 0px, 0px, 0px;
	}
	#tblHeader {
		margin-top: 1px;
		width: 800px;
		border: 0px solid #111111;
	}
	
	.td-head-left {
		padding-top: 10px;
		padding-left: 10px;
	}
	.td-head-right {
		padding-top: 10px;
		padding-left: 10px;
		border-left: 0px solid #000000;
	}
	
	#tblDetail {
		margin-top: 1px;
		width: 800px;
		border-top: 1px solid #000000;
		border-left: 1px solid #000000;
	}
	.td-detail-header {
		text-align: center;
		border-right: 1px solid #000000;
		border-bottom: 1px solid #000000;
		background-color: #DDDDDD;
	}
	.td-detail {
		border-right: 1px solid #000000;
		border-bottom: 1px solid #000000;
	}
-->
</style>

<style type="text/css" media="screen">
<!--
	.div-button {
		width: 800px;
		display: block;
		margin-top: 5px;
		margin-bottom: 5px;
	}
-->
</style>

<style type="text/css" media="print">
<!--
	.div-button {
		display: none;
	}
-->
</style>

<script type="text/javascript">
    function printReceipt(){
		window.print();
		doAfterPrint();
	}

    function doAfterPrint(){
        window.opener.location = 'reserveOverview_execute.action';
        window.close();
    }
</script>
</head>

<body>
<center>
<div class="div-button" align="center" style="overflow:auto;">
	<input type="button" value="   Print   " onclick="window.print()">
	&nbsp; &nbsp; &nbsp; &nbsp;
	<input type="button" value="   Close   " onclick="window.close()">
</div>
<h5>ใบแจ้งหนี้ / ใบเสร็จรับเงิน</h5>
</center>
<table id="tblHeader" align="center" cellspacing="0" cellpadding="0">
<tr>
	<td width="60%" class="td-head-left">ชื่อลูกค้า / Name : <s:property value="reservePrintReceiptVO.customerName"/></td>
	<td width="40%" class="td-head-right">วันที่ / Date : <s:property value="reservePrintReceiptVO.printDate"/></td>
</tr>
<tr>
	<td height="70" valign="top" class="td-head-left">ที่อยู่ / Address : <s:property value="reservePrintReceiptVO.address"/></td>
	<td valign="top" class="td-head-right">เลขที่ / No. : <s:property value="reservePrintReceiptVO.receiptNo"/></td>
</tr>
<tr>
	<td height="50" valign="top" class="td-head-left">หมายเหตุ / Remark : <s:property value="reservePrintReceiptVO.remark"/></td>
	<td valign="top" class="td-head-right">&nbsp;</td>
</tr>
</table>
<table id="tblDetail" align="center" cellspacing="0" cellpadding="0">
<tr>
	<td class="td-detail-header" width="15%">ลำดับ<br>No.</td>
	<td class="td-detail-header" width="40%">รายละเอียด<br>Description</td>
	<td class="td-detail-header" width="15%">จำนวน<br>Quantity</td>
	<td class="td-detail-header" width="15%">ราคา/หน่วย<br>Unit Price</td>
	<td class="td-detail-header" width="15%">จำนวนเงิน<br>Amount</td>
</tr>
<s:set var="sumTotalAmt" value="%{0}" />
<s:iterator value="reservePrintReceiptVO.itemDetail" status="state">
<tr>
	<td class="td-detail" align="center">&nbsp;<s:property value="#state.index+1" /></td>
	<td class="td-detail">&nbsp;<s:property value="itemName" /></td>
	<td class="td-detail" align="center">&nbsp;<s:property value="itemQty" /></td>
	<td class="td-detail" align="right">
		<s:text name="format.money">
		    <s:param name="value" value="%{unitPrice}"/>
		</s:text> &nbsp;
	</td>
	<td class="td-detail" align="right">
		<s:text name="format.money">
		    <s:param name="value" value="%{totalAmount}"/>
		</s:text> &nbsp;
	</td>
</tr>
<s:set var="sumTotalAmt" value="%{totalAmount + #attr.sumTotalAmt}" />
</s:iterator>
<tr>
	<td></td>
	<td style="border-right: 1px solid #000000">&nbsp;</td>
	<td class="td-detail" colspan="2" align="right">รวมเงิน / Sub Total &nbsp;</td>
	<td class="td-detail" align="right">&nbsp;
		<s:text name="format.money">
		    <s:param name="value" value="%{sumTotalAmt}"/>
		</s:text> &nbsp;
	</td>
</tr>
<tr>
	<td></td>
	<td style="border-right: 1px solid #000000">
		ผู้รับเงิน/Collector <u> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </u>
	</td>
	<td class="td-detail" colspan="2" align="right">ส่วนลด / Discount &nbsp;</td>
	<td class="td-detail" align="right">
		<s:if test="discountAmount != null">
			<s:text name="format.money">
			    <s:param name="value" value="%{discountAmount}"/>
			</s:text>
		</s:if> &nbsp;
	</td>
</tr>
<tr>
	<td style="border-bottom: 1px solid #000000">&nbsp;</td>
	<td class="td-detail">&nbsp;</td>
	<td class="td-detail" colspan="2" align="right">รวมเงินสุทธิ / Net Total &nbsp;</td>
	<td class="td-detail" align="right">&nbsp;
		<s:text name="format.money">
		    <s:param name="value" value="%{sumTotalAmt}"/>
		</s:text> &nbsp;
	</td>
</tr>
</table>

</body>
</html>
